#include "widget.h"
#include "ui_widget.h"

#include <QLabel>
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    srand(0);
    // QPushButton* button = new QPushButton(this);
    // button->setText("关闭");
    // button->move(200,200);
    // connect(button, &QPushButton::clicked, button, &QPushButton::close);
    connect(this, &Widget::mySignal, this, &Widget::handleMysignal);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleMysignal()
{
    this->setWindowTitle("Mysignal!");
}

void Widget::on_pushButton_clicked()
{
    ui->pushButton->move(rand()%800, rand()%600);


    emit mySignal();
}

